package gitlab_hook

import "atomgit.com/openlinksaas-org/proto-gen-go.git/events/events_gitlab"

type CommentHook struct {
	ObjectKind       string           `json:"object_kind"`
	User             User             `json:"user"`
	ProjectId        int64            `json:"project_id"`
	Project          Project          `json:"project"`
	Repository       Repository       `json:"repository"`
	ObjectAttributes ObjectAttributes `json:"object_attributes"`
	MergeRequest     MergeRequest     `json:"merge_request"`
	Commit           Commit           `json:"commit"`
	Issue            Issue            `json:"issue"`
	Snippet          Snippet          `json:"snippet"`
}

func (item *CommentHook) ToProtoBuf() *events_gitlab.CommentEvent {
	return &events_gitlab.CommentEvent{
		ObjectKind:       item.ObjectKind,
		User:             item.User.ToProtoBuf(),
		ProjectId:        item.ProjectId,
		Project:          item.Project.ToProtoBuf(),
		Repository:       item.Repository.ToProtoBuf(),
		ObjectAttributes: item.ObjectAttributes.ToProtoBuf(),
		MergeRequest:     item.MergeRequest.ToProtoBuf(),
		Commit:           item.Commit.ToProtoBuf(),
		Issue:            item.Issue.ToProtoBuf(),
		Snippet:          item.Snippet.ToProtoBuf(),
	}
}
